class RecommendPlayListItem {
  final int playCount;
  final String picUrl;
  final String name;

  const RecommendPlayListItem({
    required this.name,
    required this.playCount,
    required this.picUrl,
  });

  // 可选：从JSON转换的工厂方法
  factory RecommendPlayListItem.fromJson(Map<String, dynamic> json) {
    return RecommendPlayListItem(
      playCount: json['playCount'],
      picUrl: json['picUrl'],
      name: json['name'],
    );
  }

  // 可选：转换为Map的方法
  Map<String, dynamic> toJson() {
    return {
      'playCount': playCount,
      'picUrl': picUrl,
      'name': name,
    };
  }
}

List<RecommendPlayListItem> parseRecommendPlayListItem(
    Map<String, dynamic> json) {
  final List<dynamic> recommend = json['result'] ?? [];
  return recommend.map((item) {
    return RecommendPlayListItem(
      playCount: item['playCount'] ?? 0,
      picUrl: item['picUrl'] ?? '',
      name: item['name'] ?? '',
    );
  }).toList();
}
